package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.modules.repair.enums.MaintainPlanContentEnum;

import java.util.Date;

/**
 * @Date 10:49 2023/3/1
 * @Description {
 *    救援工单历史分页
 * }
 * @Author lsay
 **/
@Data
public class MalfunctionRescueHistoryPageVO {

	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	private String planTitle = "救援任务";

	/**
	 * 工单类型
	 */
	private Integer typeStatus;

	/**
	 * 工单类型描述
	 */
	private String typeStatusDesc;

	/**
	 * 报警类型
	 */
	private Integer trapType;

	/**
	 * 报警类型描述
	 */
	private String trapTypeDesc;

	/**
	 * 完成时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date planEndTime;

	public void setTypeStatus(Integer typeStatus) {
		this.typeStatusDesc = MaintainPlanContentEnum.getName(typeStatus);
		this.typeStatus = typeStatus;
	}

	public void setTrapType(Integer trapType) {
		if (trapType == 1) {
			this.trapTypeDesc = "伤人";
		} else {
			this.trapTypeDesc = "困人";
		}
		this.trapType = trapType;
	}

}
